﻿using System;
using System.Data;
using System.Collections.Generic;
using BOMS.Model;
namespace BOMS.BLL
{
    /// <summary>
    /// 业务逻辑类M_SubLans 的摘要说明。
    /// </summary>
    public class M_SubLans
    {
        private readonly BOMS.DAL.M_SubLans dal = new BOMS.DAL.M_SubLans();
        public M_SubLans()
        { }
        #region  成员方法
        /// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(int ID)
        {
            return dal.Exists(ID);
        }

        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BOMS.Model.M_SubLans GetModel(int ID)
        {

            return dal.GetModel(ID);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public BOMS.Model.M_SubLans GetModelByEquipMac(string Mac)
        {

            return dal.GetModelByEquipMac(Mac);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetList(string strWhere)
        {
            return dal.GetList(strWhere);
        }
     
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<BOMS.Model.M_SubLans> GetModelList(string strWhere)
        {
            DataSet ds = dal.GetList(strWhere);
            return DataTableToList(ds.Tables[0]);
        }
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List<BOMS.Model.M_SubLans> DataTableToList(DataTable dt)
        {
            List<BOMS.Model.M_SubLans> modelList = new List<BOMS.Model.M_SubLans>();
            int rowsCount = dt.Rows.Count;
            if (rowsCount > 0)
            {
                BOMS.Model.M_SubLans model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new BOMS.Model.M_SubLans();                    
                    dal.AssignModel(dt.Rows[n], model);
                    modelList.Add(model);
                }
            }
            return modelList;
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        public DataSet GetAllList()
        {
            return GetList("");
        }

        /// <summary>
        /// 获得数据列表
        /// </summary>
        //public DataSet GetList(int PageSize,int PageIndex,string strWhere)
        //{
        //return dal.GetList(PageSize,PageIndex,strWhere);
        //}

        #endregion  成员方法
    }
}

